package mobidever.mygodutch.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import mobidever.mygodutch.R;
import mobidever.mygodutch.adapter.base.AdapterBase;
import mobidever.mygodutch.bussiness.BussinessUser;
import mobidever.mygodutch.controls.SliderItem;
import mobidever.mygodutch.model.ModelUser;

public class AdapterUser extends AdapterBase
{
	BussinessUser mBussinessUser;

	private class Holder
	{
		ImageView ivIcon;
		TextView tvUserName;
	}

	public AdapterUser(List pList, Context pContext)
	{
		super(pList, pContext);
		mBussinessUser = new BussinessUser(pContext);
		List<ModelUser> _List = mBussinessUser.getNoNideUsers();
		setList(_List);
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
		
		List<ModelUser> _List = getList();
		
		Holder _Holder;
		if (convertView == null)
		{
			convertView = getLayoutInflater().inflate(R.layout.user_list_item,
					null);

			_Holder = new Holder();

			_Holder.ivIcon = (ImageView) convertView.findViewById(R.id.ivIcon);
			_Holder.tvUserName = (TextView) convertView.findViewById(R.id.tvUserName);
			convertView.setTag(_Holder);
		} else
		{
			_Holder = (Holder) convertView.getTag();
		}
		_Holder.ivIcon.setImageResource(R.drawable.user_big_icon);
		_Holder.tvUserName.setText(_List.get(position).getUserName());
		return convertView;
	}

}
